home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / dev / c / libmpeg_src.lha / configure.in < prev    next >
Encoding:
Text File  |  1996-02-26  |  6.0 KB  |  211 lines

  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT(wrapper.c)
  3. AC_CONFIG_HEADER(config.h)
  4.  
  5. # Set the default compiler options and defines (these may be 
  6. # overridden by OS-specific code below)
  7. OPT=""
  8. DEFS=""
  9.  
  10. # Get the OS, and check for a system-specific Makefile fragment to include
  11. AC_CANONICAL_HOST
  12. Makefile_OS="/dev/null"
  13. case "$host_os" in
  14.   irix*) if test -z "$CC"; then CC=cc; fi ;
  15.          extras="easympeg" ;
  16.          Makefile_OS="Makefile.irix" ;;
  17.   hpux*) if test -z "$CC"; then 
  18.            AC_CHECK_PROGS(CC, cc, none)
  19.            if test "$CC" = "cc"; then
  20.              OPT="-Aa "
  21.            else
  22.              CC=""
  23.            fi
  24.          fi
  25.          AC_DEFINE(_HPUX_SOURCE,1)
  26. esac
  27. AC_SUBST_FILE(Makefile_OS)
  28.  
  29. dnl # Look for any OS-specific chunks of Makefile (these get appended
  30. dnl # to the end of Makefile).  Currently there is only Makefile.irix,
  31. dnl # to build easympeg.
  32.  
  33. dnl AC_MSG_CHECKING(system-specific Makefile fragment)
  34. dnl if test -f Makefile.$host_os; then 
  35. dnl   Makefile_OS=Makefile.$host_os
  36. dnl   AC_MSG_RESULT($Makefile_OS)
  37. dnl else
  38. dnl   Makefile_OS="/dev/null"
  39. dnl   AC_MSG_RESULT(none)
  40. dnl fi
  41. dnl AC_SUBST_FILE(Makefile_OS)
  42.  
  43.  
  44. # Look for the C compiler (default gcc, except on SGI's and HP's), and make
  45. # sure it supports prototypes, void, and enums properly (can't trust
  46. # __STDC__).
  47.  
  48. CFLAGS=$OPT
  49. AC_PROG_CC
  50. cc_flagged=`echo "$CC $CFLAGS $CPPFLAGS" |sed 's/ +/ /;s/ *$//'`
  51. AC_MSG_CHECKING(that \"$cc_flagged\" is fairly ANSI-compliant)
  52. AC_CACHE_VAL(mpeg_cv_cc_ansi, [
  53. AC_TRY_COMPILE(, [
  54. typedef enum { RED, GREEN, BLUE, YELLOW, BLACK } colour;
  55. void *foo (colour C);
  56. colour a = GREEN;
  57.  
  58. foo (a);
  59. ], mpeg_cv_cc_ansi=yes, mpeg_cv_cc_ansi=no)])
  60. CC_ANSI=$mpeg_cv_cc_ansi
  61. AC_MSG_RESULT($CC_ANSI)
  62.  
  63. if test $CC_ANSI = no; then
  64.   AC_MSG_CHECKING(for alternative C compiler)
  65.   AC_CHECK_PROGS(ALTCC, acc, none)
  66.   if test $ALTCC = none; then
  67.     AC_MSG_ERROR(An ANSI-compliant C compiler is required to build the MPEG Library)
  68.   else
  69.     CC=$ALTCC
  70.   fi
  71. fi
  72.  
  73. # Check for ancient gcc that doesn't set an error code (but still aborts)
  74. # when we run it with a bad optimization level -- this is a problem with 
  75. # gcc 1.36 on the NeXT.
  76.  
  77. if test "$GCC" = "yes"; then
  78.   AC_MSG_CHECKING(how gcc handles bad optimization settings)
  79.   AC_CACHE_VAL(mpeg_cv_broken_gcc, [
  80.   touch conftest.c
  81.   $CC -O9 -c conftest.c 2> conftest.err
  82.   if test $? -eq 0 -a -s conftest.err; then
  83.     mpeg_cv_broken_gcc="broken"
  84.     opt_level="-O"
  85.   else
  86.     mpeg_cv_broken_gcc="fine"
  87.   fi
  88.   rm -rf conftest.*])
  89.  
  90.   AC_MSG_RESULT($mpeg_cv_broken_gcc)
  91.   if test "$mpeg_cv_broken_gcc" = "broken"; then
  92.     opt_level="-O"
  93.   fi
  94. fi
  95.   
  96. # See how high an optimization level (up to -O6) the compiler will 
  97. # let us go.  This is skipped if $opt_level is already set (eg.
  98. # by the NeXT-detector code above) because the NeXT cc dies, but 
  99. # doesn't return an error code if run with an illegal -O option!
  100.  
  101. if test -z "$opt_level" ; then
  102.   AC_MSG_CHECKING(highest available optimization level)
  103.   opt_level=""
  104.   AC_CACHE_VAL(mpeg_cv_opt_level, [
  105.   for opt in "-O" "-O2" "-O3" "-O4" "-O5" "-O6"; do
  106.     CFLAGS="$OPT$opt"
  107.     AC_TRY_COMPILE(,,mpeg_cv_opt_level=$opt,)
  108.   done
  109.   ])
  110.   opt_level=$mpeg_cv_opt_level
  111.   if [ test -z $opt_level ]; then
  112.     AC_MSG_ERROR(your compiler is broken, I give up)
  113.   fi
  114.  
  115.   AC_MSG_RESULT($opt_level)
  116. fi
  117. OPT="$OPT$opt_level"
  118. AC_SUBST(OPT)
  119. AC_SUBST(DEFS)
  120. CFLAGS="$OPT $DEFS"      # this is the final, real assigment to CFLAGS!
  121.  
  122. AC_PROG_RANLIB
  123. AC_CHECK_PROG(AR, ar, ar)
  124.  
  125. # Check for "--disable-dither" and "--disable-jpeg" options: these 
  126. # options control which files will actually be compiled and included
  127. # in the library, so it has to be done at the `configure' step.
  128. # Also, enable/disable dither controls the ENABLE_DITHER #define.
  129.  
  130. AC_ARG_ENABLE(dither,[
  131.   --enable-dither         include code for all dithering modes (default)
  132.   --disable-dither        only include code for full-colour conversion
  133.                           (useful when linking with ImageMagick)],
  134. dither=$enable_dither, dither=yes)
  135. if test $dither = yes; then
  136.   libsrc='$(DECODER_SRC) $(DITHER_SRC)'
  137.   libobj='$(DECODER_SRC:.c=.o) $(DITHER_SRC:.c=.o)'
  138.   AC_DEFINE(ENABLE_DITHER, 1)
  139.   AC_MSG_RESULT(including dithering code)
  140. else
  141.   libsrc='$(DECODER_SRC)'
  142.   libobj='$(DECODER_SRC:.c=.o)'
  143.   AC_DEFINE(ENABLE_DITHER, 0)
  144.   AC_MSG_RESULT(omitting dithering code)
  145. fi
  146. AC_SUBST(libsrc)
  147. AC_SUBST(libobj)
  148.  
  149. AC_ARG_ENABLE(jpeg,[
  150.   --enable-jpeg           include DCT code from Indep. JPEG Group (default)
  151.   --disable-jpeg          don't include the DCT code (use this when linking
  152.                           with HDF and/or JPEG libraries)],
  153. jpeg=$enable_jpeg, jpeg=yes)
  154. if test $jpeg = yes; then
  155.   
  156.   jrevdct="jrevdct.c "
  157.   extras="$extras mpegtest"
  158.   Makefile_extras="Makefile.extras"
  159.   AC_MSG_RESULT(including JPEG DCT code)
  160. else
  161.   jrevdct=""
  162.   extras=""
  163.   Makefile_extras=""
  164.   AC_MSG_RESULT(omitting JPEG DCT code)
  165. fi
  166. AC_SUBST(jrevdct)
  167. AC_SUBST(extras)
  168. AC_SUBST_FILE(Makefile_extras)
  169.  
  170. # Checks for header files.
  171. AC_HEADER_STDC
  172. AC_CHECK_HEADERS(sys/time.h unistd.h)
  173.  
  174. dnl Checks for typedefs, structures, and compiler characteristics.
  175. AC_HEADER_TIME
  176.  
  177. dnl Checks for library functions.
  178. AC_FUNC_VPRINTF
  179. AC_CHECK_FUNCS(strtod strtol lrand48)
  180. AC_CHECK_FUNC(getrusage,AC_DEFINE(HAVE_GETRUSAGE,1),AC_DEFINE(HAVE_GETRUSAGE,0))
  181.  
  182. # Try to find out where CLK_TCK is defined if we don't have getrusage.
  183. # Need to do this because IRIX puts it in <time.h> and <limit.h>, AIX
  184. # puts it in <time.h>, SunOS doesn't have it, and I dunno about anyone
  185. # else.  Note: nothing is currently done with the $clk_tck_where
  186. # value; right now I only worry about the case where CLK_TCK isn't
  187. # found at all.
  188.  
  189. if test "$ac_cv_func_getrusage" = "no"; then
  190.   AC_MSG_CHECKING(for where to find CLK_TCK symbol)
  191.   clk_tck_where=""
  192.   for hdr in "<time.h>" "<limits.h>" ; do
  193.     if test -z "$clk_tck_where"; then
  194.       AC_EGREP_CPP(yes,
  195. [#include $hdr
  196.  #ifdef CLK_TCK
  197.   yes
  198.  #endif
  199. ], clk_tck_where=$hdr)
  200.     fi
  201.   done
  202.   if test -z "$clk_tck_where"; then
  203.     AC_MSG_WARN([CLK_TCK not found, assuming 60 ticks/sec])
  204.     AC_DEFINE(CLK_TCK,60)
  205.   else
  206.     AC_MSG_RESULT($clk_tck_where)
  207.   fi
  208. fi
  209.  
  210. AC_OUTPUT(Makefile extras/Makefile)
  211.